#include "XMLManager.h"
#include "SIFTTracker.h"
#include <iostream>
#include <string>
#include "windows.h"
#include "getopt.h"

using namespace std;

int main(int argc, char* argv[])
{
	int c;
	bool lCleanFile = false;
	bool lCleanFrame = false;
	string lPath = "";
	while((c = getopt(argc,argv,"cf"))!=-1)	//clean file and frame clean (yish)
	{
		switch(c)
		{
		case 'c':
			lCleanFile = true;
			break;
		case 'f':
			lCleanFrame = true;
			break;
		case '?':
			//help
			break;
		}
	}
	if (optind < argc)	//It supposed to !
    {
		lPath = argv[optind++];
	}
	else
	{
		//help !
	}
	

	bool lOk = true;
	XMLManager lXMLTest;
	
	lXMLTest.openFile("Test.xml",lCleanFile);
	lXMLTest.init(100);

	DATObject* lDAT1 = new DATObjectSIFT;
	DATObject* lDAT2 = new DATObjectSIFT;

	lDAT1->mLastPosition.x = 1;
	lDAT1->mLastPosition.y = 3;
	lDAT1->mLastPosition.height = 3;
	lDAT1->mLastPosition.width = 7;

	lDAT2->mLastPosition.x = 4;
	lDAT2->mLastPosition.y = 2;
	lDAT2->mLastPosition.height = 2;
	lDAT2->mLastPosition.width = 1;

	Tracker* lT1 = new SIFTTracker(lDAT1);
	Tracker* lT2 = new SIFTTracker(lDAT2);

	list<Tracker*> lUT;
	lUT.push_back(lT1);
	lUT.push_back(lT2);

	lXMLTest.saveFrame(lUT,5,lCleanFrame);

	XMLManager lXMLTest2;
	
	lXMLTest2.openFile("Test2.xml",lCleanFile);
	lXMLTest2.init(10);

	list<DATObject*> lDAT;
	lDAT.push_back(lDAT1);
	lDAT.push_back(lDAT2);

	lXMLTest2.saveFrame(lDAT,lCleanFrame);
	system("pause");
	return 1;
}